Learn R Programming

diagonals (version 0.3.0)

diag<-: Matrix Diagonals

Description

A small extension of the `diag<-` function from the base package, allowing for replacement vectors smaller than the diagonal.

Usage

diag(x) <- value

Arguments

x
a matrix, vector or 1D array, or missing.
value
either a single value or a vector of length equal to that of the current diagonal. Should be of a mode which can be coerced to that of x.

Details

The `diag<-` function in the base package allows for two type of value, either of length 1, or of length equal to the length of the diagonal This function extends that by allowing